import org.molamil.acto.commands.CommandContext;
import org.molamil.acto.commands.CommandRequest;
import org.molamil.acto.commands.CommandResult;
import org.molamil.acto.commands.cmd.AbstractCmd;
import org.molamil.acto.core.EventConstants;
import org.molamil.acto.core.Logger;
import org.molamil.acto.commands.cmd.AbstractValidatorCmd;

/**
 * @author Jorge Hernandez
 */
class org.molamil.acto.commands.cmd.VoidCmd extends AbstractValidatorCmd {
	
	
	// Properties
	
	private static var log:Logger = Logger.getLogger("VoidCmd");
	
	
	// Constructor
	
	public function VoidCmd(context:CommandContext) {
		super(context);
	}
	
	
	// Functions
	
	public function execute(request:CommandRequest):CommandResult {
		
		log.debug("execute()");
		
		_result = super.execute(request);
		
		var eventObject:Object;
		if (_result.isValidated) { 
			_result.status = CommandResult.STATUS_OK;
			eventObject = {target: this, type: EventConstants.COMMAND_EXECUTE_COMPLETE, name: _request.name,  
						   result: _result.result};
		} else {
			_result.status = CommandResult.STATUS_ERROR;
			eventObject = {target: this, type: EventConstants.COMMAND_EXECUTE_ERROR, name: _request.name, 
						   result: _result.result};
		}
		dispatchEvent(eventObject);
		
		return _result;
		
	}
	
	
	
}
